﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PS_HisPrivateEditPicture.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.PS_HisPrivateEditPicture" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>รูปภาพ</title>
    <link href="../../Styles/CssClass.css" rel="cssclass" type="text/css" />
    <link href="../../Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .VisibleFalse {
            visibility: hidden;
        }
    </style>

    <script type="text/javascript">
        
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }
        
        function returnToParent() {
            try {
                var oArg = new Object();
                var fileName = document.getElementById("<%= hdfFileName.ClientID %>");
                oArg.fileName = fileName.value;
                var oWnd = GetRadWindow();

                oWnd.close(oArg);
            } catch(error) {


            }
        }

        function justClose() {
            var oWnd = GetRadWindow();
            oWnd.close();
        }

        function openPopup() {
            try {
                var fileName = document.getElementById("<%= hdfFileName.ClientID %>").value;
                var url = "../../OtherImages/Person/" + fileName;

                if (fileName !== "") {
                    //window.open("../../OtherImages/Person/" + fileName, 850, 650, 50, 10);

                    var params = [
                        'height=' + screen.height - 30,
                        'width=' + screen.width - 30,
                        'fullscreen=no'
                    ].join(',');

                    var popup = window.open(url, 'popup_window', params);
                }
            } catch (error) {
                alert(error);
            }
        }

    </script>
    <style type="text/css">
        
        .ImageDecorI { 
            -moz-border-radius: 11px;
            -webkit-border-radius: 11px;
            -khtml-border-radius: 11px;
            padding:3px;
            border:3px solid #99ccff;
            background-color:#99ccff;
            border-radius: 3px;
            max-width: 280px;
            max-height: 280px;
        } 
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="98%" class="font-label" >
            <tr>
                <td>
                    <table width="100%">
                        <tr>
                            <td style="text-align: center">
                                <asp:Image ID="previewImage" runat="server" CssClass="ImageDecorI"></asp:Image>
                            </td>
                            <td style="vertical-align: text-top;padding-left: 4px;">
                                <asp:LinkButton ID="btnClearImage" runat="server" CssClass="LinkButton" 
                                    ToolTip="ลบรูปภาพ" onclick="btnClearImage_Click">
                                    <img style="border:0px;vertical-align:middle;" alt="" src="../Images/Buttons/Cancel.gif" />
                                </asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <div style="margin-top: 1px;margin-bottom: 10px;text-align: center; font-weight: bold">
                        <asp:LinkButton ID="lbtFileName" runat="server" OnClientClick="openPopup()"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align: center">
                    <asp:FileUpload ID="fileUploader" runat="server" />
                    <asp:Button ID="btnUploadPicture" runat="server" Text="อัพโหลด" onclick="btnUploadPicture_Click" ToolTip="กดเพื่อส่งรูปขึ้นไปก่อน แล้วจึงกดตกลง"/>
                </td>
            </tr>
            
            <tr>
                <td style="text-align: center; padding-top: 2px;">
                    <asp:Label ID="lblFileTempPath" runat="server" Text="Label" Visible="False"/>
                    <asp:Button ID="btnOk" runat="server" Text="ตกลง" OnClientClick="returnToParent()"/>&nbsp;
                    <asp:Button ID="btnCancel" runat="server" Text="ยกเลิก" OnClientClick="justClose()"/>
                    
                </td>
            </tr>
        </table>
        <asp:HiddenField runat="server" ID="hdfFileName" runat="server" Value="XXXX"/>
    </div>
    </form>
</body>
</html>
